package goleetcode

import "sort"

func relocateMarbles(nums []int, moveFrom []int, moveTo []int) []int {
	mp := make(map[int]bool)
	var ans []int

	for _, num := range nums {
		mp[num] = true
	}
	for i := range moveFrom {
		delete(mp, moveFrom[i])
		mp[moveTo[i]] = true
	}
	for key := range mp {
		ans = append(ans, key)
	}
	sort.Ints(ans)
	return ans
}